package com.ts.api.module.app.config.controller.entity.vo;

import com.gitee.apanlh.util.reflection.ClassConvertUtils;
import com.ts.api.module.channel.entity.po.ChannelFlowConfigPO;
import lombok.Data;

/**
 * 渠道APP配置VO
 */
@Data
public class RespAppConfigVO {

    /** 是否开启动画 */
    private boolean enableMovie;
    /** 是否开启贷超页匹配弹窗 */
    private boolean enableMarketMatchPopUp;
    /** 是否开启贷超列表(0关闭 1开启)默认关闭 */
    private boolean enableMarketList;
    /** 是否开启表单(0关闭 1开启)") */
    private boolean enableForm;
    /** 开启短信配置 */
    private boolean enableSms;
    /** 是否开启分发流程(0关闭 1开启) */
    private boolean enableMatchFlow;
    /** 返回拦截 */
    private boolean handlerBack;
    /** 无匹配到机构时链接跳转贷超页(0关闭 1开启) */
    private boolean enableNoneOrgLinkToMarket;

    public RespAppConfigVO() {
        super();
    }

    public RespAppConfigVO(ChannelFlowConfigPO channelFlowConfigPO) {
        this.enableMovie = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableMovie());
        this.enableMarketMatchPopUp = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableMarketMatchPopUp());
        this.enableMarketList = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableMarketList());
        this.enableForm = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableForm());
        this.enableSms = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableSms());
        this.enableMatchFlow = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableMatchFlow());
        this.enableNoneOrgLinkToMarket = ClassConvertUtils.toBoolean(channelFlowConfigPO.getEnableNoneOrgLinkToMarket());
        this.handlerBack = ClassConvertUtils.toBoolean(channelFlowConfigPO.getHandlerBack());
    }

    public static RespAppConfigVO convertVO(ChannelFlowConfigPO channelFlowConfigPO) {
        if (channelFlowConfigPO == null) {
            return new RespAppConfigVO();
        }
        return new RespAppConfigVO(channelFlowConfigPO);
    }
}
